package com.yzg.simple.netty.http;

import com.yzg.simple.netty.officialchat.server.NettyOfficialTcpServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 *
 * 自定义 子处理器
 */
public class NettyHttpInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        //自定义 http请求的编码与解码器
        pipeline.addLast("HttpServerCodec",new HttpServerCodec());
        pipeline.addLast("HettyHttpHander",new HettyHttpHander());

    }
}
